package com.controller;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.common.Signature.*;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfSignatureAppearance;
import com.itextpdf.text.pdf.security.DigestAlgorithms;

@RestController
public class SignaturePdfController {

	@PostMapping("/uploadFile") // 上传单个文件
	public String test(@RequestParam("file") MultipartFile file) throws Exception {

	}

	@PostMapping("/batch") // 批量上传文件
	public String batch(HttpServletRequest r) throws Exception {
		return timePath;
	}

	public static void copyFile(File resource, File target) throws Exception {

	}

	@PostMapping("/signatureMultiUser") // 批量上传文件
	public ResponseEntity<?> signatureMultiUser(@RequestBody String name) {

	}

	@PostMapping("/signature") // 批量上传文件
	public String signature(HttpServletRequest r, @RequestParam("certId") String certId,
			@RequestParam("pageNum") int[] pageNum, @RequestParam("rectX") int[] rectX,
			@RequestParam("rectY") int[] rectY) throws Exception {
		return "sigPdf";
	}

}
